﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Subfaculty.Common.Entities;
using Subfaculty.WebApplication.ViewModels;

namespace Subfaculty.WebApplication.Translators
{
	public class StudyYearTranslator : BaseTranslator<StudyYear, StudyYearViewModel>
	{
		public override StudyYearViewModel Translate(StudyYear source)
		{
			var pe = new StudyYearViewModel();

			pe.Id = source.Id;
			pe.StartDate = source.StartDate;
			pe.EndDate = source.StartDate + 1;

			return pe;
		}

		public override StudyYear TranslateBack(StudyYearViewModel pe, StudyYear entity)
		{
			entity.Id = pe.Id;
			entity.StartDate = pe.StartDate;
			entity.EndDate = pe.StartDate + 1;

			return entity;
		}
	}
}